<?

if(Yii::app()->user->hasFlash('model')) {
	Yii::app()->user->flash('model', array('<div class="confirmation">', '</div>'));
	return;
}

?>

<div class="yiiForm">

<?php echo CHtml::beginForm(); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>
	<?php if(Yii::app()->user->isGuest): ?>
	<div class="simple">
		<?php echo CHtml::activeLabelEx($model,'author'); ?>
		<?php echo CHtml::activeTextField($model,'author',array('size'=>60,'maxlength'=>128)); ?>
		<?php echo CHtml::error($model,'author'); ?>
	</div>

	<div class="simple">
		<?php echo CHtml::activeLabelEx($model,'email'); ?>
		<?php echo CHtml::activeTextField($model,'email',array('size'=>60,'maxlength'=>128)); ?>
		<?php echo CHtml::error($model,'email'); ?>
	</div>

	<div class="simple">
		<?php echo CHtml::activeLabelEx($model,'url'); ?>
		<?php echo CHtml::activeTextField($model,'url',array('size'=>60,'maxlength'=>128)); ?>
		<?php echo CHtml::error($model,'url'); ?>
	</div>
	<?php endif; ?>
	<div class="simple">
		<?php echo CHtml::activeLabelEx($model,'content'); ?>
		<?php echo CHtml::activeTextArea($model,'content',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo CHtml::error($model,'content'); ?>
	</div>

	<div class="action">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Submit' : 'Save',array('class'=>'submit')); ?>
	</div>

<?php echo CHtml::endForm(); ?>

</div><!-- form -->

<script type="text/javascript">
$('form').bind("submit", function() { return false; });

$('.submit').bind("click", function () {
  jQuery.ajax({
'type':'POST',
'dataType' : 'html',
'url': jQuery(this).parents("form").attr("action"),
'cache':false,
'data':jQuery(this).parents("form").serialize(),
'success':function(html){
jQuery("#content").html(html)}
});
  return false;
});
</script>
